package Lesson02;

public class Demo_204 {
    public static void main(String[] args) {
        Thread thread = new Thread(()->{
            while (true){
                System.out.println("hello thread...");
                try {
                    Thread.sleep(1000);
                }catch (InterruptedException e){
                    e.printStackTrace();
                }
            }
        });
        //设置为后台线程
        thread.setDaemon(true);
        //启动
        thread.start();
        System.out.println("线程是否存活: "+thread.isAlive());
        System.out.println("main 方法执行完成");
    }
}
